<?php if($model->checkAdmin || $model->countEvents) : ?>
	<div class="u_cat">
		<div class="u_cat_head_strip"></div>
		<div class="u_cat_head">
			<a href="<?php echo Yii::app()->createUrl('event/index',array('group'=>$model->id));?>">
				<em>мероприятия</em><span><?php echo CHtml::encode($model->countEvents); ?></span>
			</a>
		</div>
		<?php if($model->countEvents) : ?>
		<div class="u_cont_list ajaxLinks">
			<?php foreach ($model->events as $event) : ?>
			<div class="u_cont">
				<a href="<?php echo Yii::app()->createUrl('event/view', array('event'=>$event->id));?>" class="u_cont_pic">
					<?php echo isset($event->avatar_info->name) ? $this->material_image(0, $event->avatar_info->name, '40', 'events/'. $event->id . '/' . 0) : $this->material_image(0, 'fuck', '40', 'events/'. $event->id . '/' . 0); ?>
				</a>
				<div class="u_cont_r">
					<a href="<?php echo Yii::app()->createUrl('event/view', array('event'=>$event->id));?>" class="u_cont_h2">
						<?php echo CHtml::encode($event->name); ?>
					</a>
					<p class="u_cont_black"><?php echo Yii::app()->dateFormatter->formatDateTime($event->begin, 'long','short'); ?></p>
				</div>
			</div>
			<?php endforeach; ?>
		</div>
		<?php else : ?>
		<div class="u_cont_list">
			<div class="u_cont">
				<div class="u_cont_r_empty ajaxLinks">
					В сообществе ещё нет мероприятий.
					<?php if(isset( $model->checkAdmin )) : ?>
						<p><a href="<?php echo Yii::app()->createUrl('event/create',array('group'=>$model->id));?>" class="u_cont_h2_discussion ajaxLink">
							Добавить 
						</a></p>
					<?php endif ?>
				</div>
			</div>
		</div>
		<?php endif; ?>
	</div>
<?php endif; ?>